﻿using Project.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project.DAL
{
    public class DDmanageDal : BaseDal<DDmanage>
    {
        Entities model = new Entities();

        public bool delectdan(int id)
        {
            var list = model.DDmanageDetail.Where(d => d.Dgdetail_id == id);

            model.DDmanageDetail.RemoveRange(list);

            int count = model.SaveChanges();

            return count > 0;

        }


        public bool delectduo(int[] id)
        {
            bool zt = true;

            foreach (int i in id)
            {
                var list = model.DDmanageDetail.Where(d => d.Dgdetail_id == i);

                model.DDmanageDetail.RemoveRange(list);

                int count = model.SaveChanges();

                if (count < 0)
                {
                    zt = false;
                }
            }

            return zt;

        }
    }
}
